<!DOCTYPE html>
<html lang="en" xmlns:sec="http://www.thymeleaf.org/thymeleaf-extras-springsecurity5">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>
<a href="/toLogin" sec:authorize="isAnonymous()">登录</a>
<a href="/logout" sec:authorize="isAuthenticated()">注销</a>
<h3>欢迎 <span sec:authentication="principal.username"></span></h3>
<h3>权限列表 <span sec:authentication="authorities"></span></h3>
<h3 sec:authorize="hasRole('ROLE_管理员')">管理员角色</h3>
<h3 sec:authorize="hasRole('ROLE_访客')">访客角色</h3>
<h3 sec:authorize="hasAuthority('admin:read')">管理员写权限</h3>
<h3 sec:authorize="hasAuthority('admin:write')">管理员读权限</h3>
<h3 sec:authorize="hasAuthority('guest:write')">访客写权限</h3>
<h3 sec:authorize="hasAuthority('guest:read')">访客读权限</h3>
<h3 sec:authorize="hasAnyAuthority('all:write','admin:write','guest:write')">所有人写权限</h3>
<h3 sec:authorize="hasAnyAuthority('all:read','admin:read','guest:read')">所有人读权限</h3>

</body>
</html>